#include <assert.h>
#include <iostream>
#include "mainapp.h"

#include "../chat/chatmessagehandle.h"
#include "../chat/handelchatmessage.h"

namespace QinChat{
    namespace App{
        CMainApp* CMainApp::m_mainApp = nullptr; 

        CMainApp::CMainApp():m_mainThreadPool(5){
			std::cout<<"init\n";
            assert(nullptr == m_mainApp);
            m_mainApp = this;
			std::cout<<"init mainapp\n";

            Init();
        }

        CMainApp::~CMainApp(){

        }

        void CMainApp::Init(void){
            m_CChatMessageHandle.Regist("Login", new Chat::CHandelLoginMessage());
        }

        Core::CThreadPool& CMainApp::GetThreadPool(void){
            return m_mainThreadPool;
        }

        Chat::CChatMessageHandleRegist& CMainApp::GetChatMessageHandleRegist(){
            return m_CChatMessageHandle;
        }

        CMainApp& CMainApp::GetInstace(){
            return (*m_mainApp);
        }
    }
}